<?php
if(have_posts())
{
	$image_rs = new SimpleImage();
	while (have_posts())
	{
		the_post();
		$postID = get_the_ID();
		$title = get_the_title($postID);
		$perlink = get_permalink($postID);
		$alt = db_get_alt_attachment_id($postID, $wpdb->prefix.'thumbnail');
		if(!$alt)
			$alt = db_vietnamese_slug($title);
		$thumbnail = db_get_post_meta($postID, $wpdb->prefix.'thumbnail');
		if($thumbnail)
			$thumbnail = db_resizeImage($image_rs, $thumbnail, 149, 79);
		$price = get_post_meta($postID,$wpdb->prefix.'price',true);
		$location = get_post_meta($postID, $wpdb->prefix.'location',true);
		$rating = get_post_meta($postID, $wpdb->prefix.'rating',true);
		?>
		<li>
            <div class="box-img">
            <a href="<?php echo $perlink;?>" title="<?php echo $title;?>">
                 <img alt="<?php echo $alt;?>" src="<?php echo $thumbnail;?>" />
             </a>    
            </div>
            <div class="box-info">
               <div class="star">
				<?php
				for ($j=1;$j<=$rating;$j++)
				{
				?>
				<img alt="" src="<?php bloginfo('template_url');?>/images/star.png" />
				<?php 	
				} 
				?>               	                  
               </div>
               <div class="details-info">
                   <a href="<?php echo $perlink;?>" class="name"><?php echo $title;?></a>
                      <span class="price">Price: <?php echo $price;?> USD</span>
                      <span class="note"><?php echo $location;?></span>
                </div>
             </div>
         </li>
		<?php 
	}
	wp_reset_query();
	unset($image_rs);
}
else 
{
	echo 'No Hotel!.';
}